var http=require('http');
var options={
	hostname:'www.example.com',
	port:80,
	path:'/upload',
	method:'POST',
	headers:{
		'Content-Type':'application/x-www-form-urlencode'
	}
}
var request=http.request(options,function(response){});
request.write('Hello World');
request.end();


//先打开node server.js
//再执行node client.js
http.get('http://127.0.0.1:8001', function (response) {
    var body = [];

    console.log(response.statusCode);
    console.log(response.headers);

    response.on('data', function (chunk) {
        body.push(chunk);
    });

    response.on('end', function () {
        body = Buffer.concat(body);
        console.log(body.toString());
    });
});
